﻿using System;
using System.Collections.Generic;
using System.Text;
using WMS.IDAL;
using WMS.Entity;

namespace WMS.BLL
{
    public class Unit
    {
        private static readonly IUnit dal = WMS.DAL.Factory.DataAccess.CreateUnitObject();

        /// <summary>
        /// 获取全部计量单位
        /// </summary>
        /// <returns></returns>
        public IList<UnitEntity> GetAllUnit()
        {
            return dal.GetAllUnit();
        }

        /// <summary>
        /// Add Unit
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public int AddUnit(UnitEntity entity)
        {            
            return dal.AddUnitInfo(entity);
        }

        public int UpdateUnit(UnitEntity entity)
        {
            return dal.UpdateUnitInfo(entity);
        }

        public int DeleteUnit(UnitEntity entity)
        {
            return DeleteUnitBy(entity.UnitID);
        }

        public int DeleteUnitBy(int unitID)
        {
            return dal.DeleteUnitInfo(unitID);
        }
    }
}
